<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../../css/lib/mui/mui.css">
		<link rel="stylesheet" href="../../css/common/animate.css">
		<link rel="stylesheet" href="../../css/common/common.css"/>
	</head>

	<body>
		<header class="header-backcolor mui-bar mui-bar-nav">
			<a id="title_icon" class="mui-action-back  pan_header_a_left">
					<div id="backBtn">
						<img id="back_img" src="../../img/menu/ico_return.png" class="pan_header_left_img_block" >
						<button class="mui-action-back mui-btn mui-btn-blue mui-btn-link mui-btn-nav mui-pull-left">
							<span class="pan_header_left_span_block" id="back">返回</span>
						</button>
					</div>
			</a>
			<h1 class="mui-title" id="title">个人设置</h1>
		</header>
		<div class="mui-content">
			<form class="mui-input-group" id="dataForm" style="margin-top: 50px;">
					<input type="hidden" name="sysUser.id" id="useruuid"/>
					<div class="mui-input-row">
						<label>联系方式</label>
						<input type="text" id="mobile" name="sysUser.mobile">
					</div>
					<div class="mui-input-row">
						<label>身份证号</label>
						<input type="text" id="idcard" name="sysUser.idcard">
					</div>
					<div class="mui-input-row">
						<label>流动党员</label>
					</div>
					<div class="mui-input-row">
						<div class="mui-input-row mui-radio">
							<label>否</label>
							<input name="sysUser.type" type="radio" id="yesLD" value="LD">
						</div>
					</div>
					<div class="mui-input-row">
						<div class="mui-input-row mui-radio">
							<label>是</label>
							<input name="sysUser.type" type="radio" id="noLD" value="ZS">
						</div>
					</div>
			</form>
			<center style="margin-top: 60px;">
				<button id="exit" type="button" class="mui-btn mui-btn-danger" style="width: 90%;height: 35px;border-radius: 21px;"  onclick="submitForm()">
						保存
				</button>	
			</center>
		</div>
		<script type="text/javascript" src="../../js/common/config.js" ></script>
		<script type="text/javascript" src="../../js/lib/mui/mui.js"></script>
		<script type="text/javascript" src="../../js/lib/jquery/jquery.js"></script>
		<script type="text/javascript" src="../../js/common/common.js" ></script>
		<script type="text/javascript" src="../../js/lib/jquery/jquery.json.js" ></script> 
		<script>
			mui.init({
				swipeBack:false, //启用右滑关闭功能
				keyEventBind: {
					backbutton: false  //关闭back按键监听
				}
			}); 
			mui.plusReady(initSomething);
			
			var userid;
			function initSomething(){
				var self = plus.webview.currentWebview();
				userid = common.utils.getUserId();
				$("#useruuid").val(self.useruuid);
				$("#mobile").val(self.mobile);
				$("#idcard").val(self.idcard);
				var type = self.type;
				if("ZS"==type){
					$("#yesLD").attr("checked","checked");
				}else{
					$("#noLD").attr("checked","checked");
				}
			}
			function submitForm(){
				mui.ajax(ctx+"mobile/common/updateUser",{
					dataType:'json',//服务器返回json格式数据
					type:'post',//HTTP请求类型
					data:{
						"sysUser.id":$("#useruuid").val(),
						"sysUser.mobile":$("#mobile").val(),
						"sysUser.idcard":$("#idcard").val(),
						"sysUser.type":$("input[name='sysUser.type']").val()
					},
					timeout:10000,//超时时间设置为10秒；
					success:function(data){
				       	if(data&&data.success){
				       		var wobj = plus.webview.getWebviewById("app/me/me.html");
							wobj.reload(true);
				       		alert(data.message);
				       	}else{
				      		alert('服务器异常链接失败!');
				      	}
					},
					error:function(xhr,type,errorThrown){
						alert('服务器异常链接失败!');
					}
				});
			}
		</script>
	</body>
</html>
